import { getTempList } from '@/api/smartMarketing/drainage/groupFission';
// 用户数据搜索配置项
export const userConfig = (activeId: any) => [
    {
        label: '用户昵称',
        name: 'name',
        value: '',
        type: 'input',
        placeholder: '请输入用户昵称'
    },
    {
        label: '裂变等级',
        name: 'fission_level',
        value: '',
        type: 'select',
        filterable: true,
        placeholder: '请选择裂变级别',
        fetchOptionApi: () => {
            return new Promise(resolve => {
                getTempList({ id: activeId, type: 1 }).then((res: any) => {
                    resolve([{ id: 'all', name: '全部' }, ...(res || [])]);
                });
            });
        },
        formatOption: (v: any) => ({
            label: v.name,
            value: v.id
        })
    },
    {
        label: '达成阶梯等级',
        name: 'step_level',
        value: '',
        type: 'select',
        filterable: true,
        placeholder: '请选择达成阶梯等级',
        fetchOptionApi: () => {
            return new Promise(resolve => {
                getTempList({ id: activeId, type: 2 }).then((res: any) => {
                    resolve([{ id: 'all', name: '全部' }, ...(res || [])]);
                });
            });
        },
        formatOption: (v: any) => ({
            label: v.name,
            value: v.id
        })
    },
    {
        label: '领奖阶梯等级',
        name: 'receive_step_level',
        value: [],
        multiple: true,
        type: 'select',
        filterable: true,
        placeholder: '请选择领奖阶梯等级',
        fetchOptionApi: () => {
            return new Promise(resolve => {
                getTempList({ id: activeId, type: 3 }).then((res: any) => {
                    resolve(res);
                });
            });
        },
        formatOption: (v: any) => ({
            label: v.name,
            value: v.id
        })
    },
    {
        label: '是否限制',
        name: 'is_limit',
        value: '',
        type: 'select',
        clearable: true,
        placeholder: '请选择是否限制',
        optionList: [
            { name: '全部', id: 'all' },
            { name: '是', id: '2' },
            { name: '否', id: '1' }
        ],
        formatOption: (v: any) => ({
            label: v.name,
            value: v.id
        })
    },
    {
        label: '是否新客户',
        name: 'is_new',
        value: '',
        type: 'select',
        clearable: true,
        placeholder: '请选择是否新客',
        optionList: [
            { name: '全部', id: 'all' },
            { name: '是', id: '2' },
            { name: '否', id: '1' }
        ],
        formatOption: (v: any) => ({
            label: v.name,
            value: v.id
        })
    },
    {
        label: '是否群成员',
        name: 'is_group_member',
        type: 'select',
        value: '',
        clearable: true,
        placeholder: '请选择是否群成员',
        optionList: [
            { name: '全部', id: 'all' },
            { name: '是', id: '2' },
            { name: '否', id: '1' }
        ],
        formatOption: (v: any) => ({
            label: v.name,
            value: v.id
        })
    },
    {
        label: '入群时间',
        name: 'join_time',
        value: [],
        type: 'datePicker',
        datePickerType: 'daterange',
        datePickerFormat: 'YYYY-MM-DD',
        valueFormat: 'YYYY-MM-DD HH:mm:ss',
        startPlaceholder: '开始日期',
        endPlaceholder: '结束日期'
    },
    {
        label: '退群时间',
        name: 'retreat_time',
        value: [],
        type: 'datePicker',
        datePickerType: 'daterange',
        datePickerFormat: 'YYYY-MM-DD',
        valueFormat: 'YYYY-MM-DD HH:mm:ss',
        startPlaceholder: '开始日期',
        endPlaceholder: '结束日期'
    }
];

// 奖品数据搜索配置项
export const prizeConfig = (activeId: any) => [
    {
        label: '用户昵称/奖品名称',
        name: 'name',
        value: '',
        type: 'input',
        placeholder: '请输入用户昵称/奖品名称'
    },
    {
        label: '奖品等级',
        name: 'reward_level',
        value: '',
        type: 'select',
        filterable: true,
        placeholder: '请选择奖品等级',
        fetchOptionApi: () => {
            return new Promise(resolve => {
                getTempList({ id: activeId, type: 4 }).then((res: any) => {
                    resolve([{ id: 'all', name: '全部' }, ...(res || [])]);
                });
            });
        },
        formatOption: (v: any) => ({
            label: v.name,
            value: v.id
        })
    },
    {
        label: '奖品状态',
        name: 'reward_status',
        type: 'select',
        value: '',
        clearable: true,
        placeholder: '请选择奖品状态',
        optionList: [
            { name: '全部', id: 'all' },
            { name: '库存锁定中', id: 1 },
            { name: '已领取', id: 2 },
            { name: '库存释放', id: 3 },
            { name: '库存不足未发放', id: 4 }
        ],
        formatOption: (v: any) => ({
            label: v.name,
            value: v.id
        })
    },
    {
        label: '核销状态',
        name: 'verification_status',
        type: 'select',
        value: '',
        clearable: true,
        placeholder: '请选择核销状态',
        optionList: [
            { name: '全部', id: 'all' },
            { name: '已核销', id: 2 },
            { name: '未核销', id: 1 },
            { name: '核销中', id: 3 },
            { name: '核销失败', id: 4 }
        ],
        formatOption: (v: any) => ({
            label: v.name,
            value: v.id
        })
    },
    {
        label: '是否有效',
        name: 'is_effect',
        type: 'select',
        value: '',
        clearable: true,
        placeholder: '请选择是否有效',
        optionList: [
            { name: '全部', id: 'all' },
            { name: '有效', id: 1 },
            { name: '无效(超时未核销)', id: 2 },
            { name: '无效(用户已限制)', id: 3 },
            { name: '无效(单一奖励放弃领取该奖品)', id: 4 },
            { name: '无效(助力回退不满足中奖条件)', id: 5 }
        ],
        formatOption: (v: any) => ({
            label: v.name,
            value: v.id
        })
    }
];
